//============================================================================
// Name        : algebra-solver.cpp
// Author      : Ines Bonacic and Vatroslav Dino Matijas
// Version     : 1.0
// Copyright   : Your copyright notice
// Description : Human readable, step by step, algebra solver for basic problems
//============================================================================

#include <iostream>
using namespace std;
#include "IntegerEx.h"
#include "AddEx.h"
#include "ProblemEx.h"

template<class T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
template<class T>
T lcd(T a, T b) {
	return a*b/gcd(a,b);
}
int main() {
	Expression* problem = new ProblemEx(new AddEx(new AddEx(new IntegerEx(2),new IntegerEx(3)),new IntegerEx(1)));
	do {
		problem->toString(cout);
		cout<<endl;
	} while(problem->simplify());
	delete problem;
	cout<<lcd(6,9)<<endl;
	return 0;
}
